In general, electronic documents, such as, for example, Extensible Markup Language (XML)-based documents, often have an associated set of rules or grammar that describes the allowable syntactic constraint or structure. In the case of XML-based documents, this grammar is expressed in one of at least two possible formats: a Document Type Definition (DTD) or an XML-Schema. Each format essentially describes XML tags (e.g., sub-tags) that are allowed under a given XML tag. A document that conforms to the syntax rules found in the associated grammar is considered to be a valid document.
Often, syntax rules define additional constraints, referred to herein as semantic constraints, that are not considered to be part of the grammar and thus are not uniformly applied. For instance, certain syntax rules may declare that a sub-tag is optional, or the syntax rules may define a minimum and/or maximum number of times a sub-tag can be allowed under a given XML tag. However, the actual number of times a sub-tag is used will vary depending upon the particular application employing the document.
The following are some common examples of semantic constraints that are not presently captured in a conventional grammar model:                1. There are semantically and syntactically valid choices for sub-trees for any tag in the XML-based document;        2. Each choice of a sub-tree of a tag can imply the automatic selection and/or exclusion of a sub-tree of another tag (not related to the first tag by ancestry). These are called selection constraints. By way of example, FIG. 1 illustrates selection constraints in a Trading Partner Agreement (TPA) application. In this application, the TPA 100 has a section defining participants 102 and a section defining communications 104. The Participants section 102 may have two alternatives: “Alternative 1” 106, where both parties are arbitrary and all information must be entered at the time of authoring; and “Alternative 2” 108, where one of the participants is known, and information pertaining to the known participant is supplied in the model. In the Communications section 104, there may be two alternatives: “Alternative A” 110, where the communications protocol is unknown and must be selected; and “Alternative B” 112, where the protocol is known, as it is the only protocol supported by the known service provider. If the first alternative 106 in the participants section 102 is chosen (i.e., where both parties are arbitrary), then the first alternative 110 in the communications section 104 is required. Similarly, if the second alternative 106 in the participants section 102 is chosen (i.e., where the service provider is known), then the second alternative 112 in the communications section 104 should be required;        3. While a grammar may describe a tag as optional, the semantics may specify that the tag is required, prohibited, or truly optional (and left to the author for possible inclusion during the authoring of the document);        4. While a grammar may describe the minimum and/or maximum number of times a sub-tag may be included as a child of a given (parent) tag, the semantics may further require a particular number of inclusions, or it may leave the actual number to the author during the authoring of the document;        5. While a grammar may describe the data type (specifically, the XML Schema can do this), the form of the data (e.g., date format) can vary depending upon the semantics of the document (e.g., UK time vs. U.S. time vs. military time, etc.);        6. Data fields and attributes may have default values;        7. Orderable data fields can have minimum and/or maximum values;        8. Several fields (e.g., data and attribute) must have the same value, such that when one is changed, the other fields must reflect the change.        
Conventionally, there are primarily two ways an XML-based document can be constructed so that it is both syntactically and semantically valid. The first approach involves the use of an XML editor that utilizes the grammar to force conformance to the syntax rules described in the grammar. Since the editor has no knowledge of the application being addressed, however, the semantic constraints are left to the person (or author) constructing the document. Often, a manual or guide prepared by an expert can be used to assist the author. There is, nevertheless, no assurance that the resulting XML-based document is semantically valid, since the author's subjective interpretation of the guide might have been incorrect.
A second conventionally used approach for constructing an XML-based document that is both syntactically and semantically valid is to use an XML editor that is specifically written for the particular application being addressed. The semantic rules would be captured in the logic of the XML editor. As such, however, the rules cannot be easily modified, and each application requiring different semantics would require a different XML editor.
Recent trends in business-to-business operations involve the description of services performed by one business partner on behalf of another. This description has been written as an XML-based document. Considering the Trading Partner Agreement (TPA) example described above, such a document not only describes the various services performed, but the format of messages between partners, the protocol used to transmit the messages, and actions taken when one of the partners is unable to operate normally. There are semantic relationships between many sections of the TPA, so that, for example, the structure or content of one section is dependent upon the structure or content of another. Ordinarily, the semantic validity of a TPA cannot be easily verified without attempting to build the business-to-business framework described by the TPA. It is too expensive to verify the validity of a document in this manner. Rather, it would be advantageous to be able to force the validity of the document during the authoring of the TPA.
As businesses and other suitable applications begin to focus, for example, on XML as a useful description language for documents, such as contracts and processes, the need to verify the semantic validity of these documents becomes imperative. Presently, there is no means to adequately specify semantic constraints similar to the manner in which syntactic constraints are described in a grammar. There is a need, therefore, in the field of document authoring (e.g., XML documents), for a semantic model, and an implementation thereof, in which semantic constraints can be easily and efficiently described and verified.